Page({
  data: {
    requestListOfBikeSiltation: [],

    requestListOfBikeDispatch: []
  },

  onLoad: function (event) {
    this.getRequestProcess()
  },

  onShow: function (event) {
    this.getRequestProcess()
  },

  getRequestProcess() {
    var that = this
    wx.request({
      url: getApp().globalData.commonIP + '/bikeRequest/getRequestListByNickName',
      method: 'GET',
      header: {
        'content-type': 'application/json', // 默认值
        'token': wx.getStorageSync('token')
      },
      data: {
        nickName: wx.getStorageSync('nickName')
      },
      success: res => {
        if (res.data.msg == "token过期，请重新登录" || res.data.msg == "token失效，请重新登录" || res.data.msg == "无效签名，请重新登录" || res.data.msg == "token算法不一致，请重新登录") {
          wx.showModal({
            title: '提示',
            content: res.data.msg,
            showCancel: false,
            complete: (res) => {
              if (res.cancel) {

              }

              if (res.confirm) {
                // 重置全局变量和去除缓存
                getApp().globalData.wxusername = ''
                getApp().globalData.wxuseravatar = ''
                wx.removeStorageSync('nickName')
                wx.removeStorageSync('avatarUrl')
                wx.removeStorageSync('token')

                wx.switchTab({
                  url: '/pages/index/index'
                })
              }
            }
          })
          return
        }
        if (res.data.msg == '操作成功') {
          that.setData({
            requestListOfBikeSiltation: res.data.data.bikeSiltation,
            requestListOfBikeDispatch: res.data.data.bikeDispatch
          })
        } else {
          wx.showModal({
            title: '提示',
            content: res.data.msg,
            showCancel: false
          })
        }
      }
    })
  }

})